/**
 * admui-basic v2.1.0 (http://www.admui.com/)
 * Copyright 2015-2019 Admui Team
 * Licensed under the Admui License 1.1 (http://www.admui.com/about/license)
 */
(function(window, document, $) {
  'use strict';

  window.App.extend({
    run: function() {
      var table = $('#dataTableExample').DataTable($.concatCpt('dataTable'));
      var $pageContent = $('#admui-pageContent');

      $pageContent.on('click', '#dataTableExample tbody tr', function() {
        if ($(this).hasClass('selected')) {
          $(this).removeClass('selected');
        } else {
          table.$('tr.selected').removeClass('selected');
          $(this).addClass('selected');
        }
      });

      $pageContent.on('click', '#DTDelRow', function() {
        table
          .row('.selected')
          .remove()
          .draw(false);
      });
    }
  });

  window.App.run();
})(window, document, jQuery);
